package com.hll.spring.mybatis;

import com.hll.spring.mybatis.mapper.SchoolMapper;
import com.hll.spring.mybatis.mapper.UserMapper;
import com.hll.spring.mybatis.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author hll
 * @create 2022-05-11 15:51
 */
@RunWith(SpringJUnit4ClassRunner.class) // 单元测试框架
@ContextConfiguration("classpath:spring.xml") // 加载配置文件
public class SpringTest {
  @Autowired private UserService userService;
  @Autowired private UserMapper userMapper;

  @Autowired private SchoolMapper schoolMapper;

  @Test
  public void test1() {
    userService.updateSomeThing();
  }

  @Test
  public void test2() {
    long start = System.currentTimeMillis();
    System.out.println(userMapper.getUsersWithSchool());
    System.out.println(userMapper.getUsersWithSchool());
    System.out.println(userMapper.getUsersWithSchool());
    System.out.println(System.currentTimeMillis() - start);
  }
}
